package com.sf.factory.simple;

import com.sf.factory.ICourse;

public class SimpleFactory {

    /**
     *  简单工厂模式
     * @param cla
     * @return
     */
    public ICourse create(Class<? extends ICourse> cla){
        try {
            if(cla != null){
                return cla.newInstance();
            }
        } catch (InstantiationException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        }
        return null;
    }
}
